package com.stb.llh.config;

/**
 * @Author Lee
 * @Date 2021/11/8
 * @Description
 */


import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import java.util.concurrent.atomic.AtomicInteger;

@WebListener
public class UserConfig implements HttpSessionListener {
    public volatile static AtomicInteger count = new AtomicInteger(0);

    @Override

    public void sessionCreated(HttpSessionEvent se) {

        System.out.println("创建session");

        count.addAndGet(1);

    }

    @Override

    public void sessionDestroyed(HttpSessionEvent se) {

        System.out.println("销毁session");

        count.addAndGet(-1);

    }
}
